from pydantic import BaseModel, conint, confloat, Field


class SingleFrequency(BaseModel):
    double: bool = Field(default=False, allow_mutation=False)
    rx_frequency: conint(ge=1) = 1_750_000_000

    class Config:
        validate_assignment = True


class DoubleFrequency(SingleFrequency):
    double: bool = Field(default=True, allow_mutation=False)
    tx_frequency: conint(ge=1) = 1_850_000_000

    class Config:
        validate_assignment = True


class SingleGain(BaseModel):
    double: bool = Field(default=False, allow_mutation=False)
    gain_0: conint(ge=0, le=70) = 20

    class Config:
        validate_assignment = True


class DoubleGain(SingleGain):
    double: bool = Field(default=True, allow_mutation=False)
    gain_1: conint(ge=0, le=70) = 20

    class Config:
        validate_assignment = True


class SingleAttenuation(BaseModel):
    double: bool = Field(default=False, allow_mutation=False)
    attenuation_0: confloat(ge=0, le=70.0) = 40.0

    class Config:
        validate_assignment = True


class DoubleAttenuation(SingleAttenuation):
    double: bool = Field(default=True, allow_mutation=False)
    attenuation_1: confloat(ge=0, le=70.0) = 40.0

    class Config:
        validate_assignment = True


class SingleConfig(BaseModel):
    double: bool = Field(default=False, allow_mutation=False)
    rx_frequency: conint(ge=1) = 1_750_000_000
    gain_0: conint(ge=0, le=70) = 20
    attenuation_0: confloat(ge=0, le=70.0) = 40.0
    rx_bandwidth: conint(ge=1) = 56_000_000
    tx_bandwidth: conint(ge=1) = 56_000_000
    sample_rate: conint(ge=1) = 60_000_000

    class Config:
        validate_assignment = True


class DoubleConfig(SingleConfig):
    double: bool = Field(default=True, allow_mutation=False)
    tx_frequency: conint(ge=1) = 1_850_000_000
    gain_1: conint(ge=0, le=70) = 20
    attenuation_1: confloat(ge=0, le=70.0) = 40.0

    class Config:
        validate_assignment = True
